sdcard: Adding tests for csd parsing.#1062
Open
benwynn wants to merge 1 commit intomicropython:masterfrom
Open
sdcard: Adding tests for csd parsing.#1062benwynn wants to merge 1 commit intomicropython:masterfrom
benwynn wants to merge 1 commit intomicropython:masterfrom
Conversation
Signed-off-by: Ben Wynn <bwynn@glowie.com>
Contributor
Author
|
@projectgus Here's a test of the bits I changed recently, at least. |
projectgus
reviewed
Jan 21, 2026
Contributor
projectgus
left a comment
There was a problem hiding this comment.
Hi @benwynn, sorry it's taken a while for someone to get back to you with this change - appreciate you putting in the time to improve test coverage.
I have some quite small SD cards kicking around somewhere, so I'll try to get some additional CSD values - although I think merging with the two you already have would be a benefit by itself.
| csd = bytearray(16) | ||
| self.readinto(csd) | ||
|
|
||
| def parse_csd(self, csd): |
Contributor
There was a problem hiding this comment.
Is there a use case for the parse_csd function other than unit testing?
If not then it's probably better to put the complexity into MockSDCard if possible (i.e. have it handle cmd(9, ...) and then prepare the response data).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On my last PR that updated the parsing of the CSD register,
I was asked if a test could be provided.
Here's a test for the csd parsing, with csd values
recorded from the two cards I currently have available.
I've ordered some smaller cards so I can record and test
additional values, but happy to have others contribute
test-cases as well.